package algo3c3g7.mvc;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JSpinner;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;



import com.sun.org.apache.bcel.internal.generic.Select;

public class ControladorIntervalos {

	private ModeloIntervalos modeloIntervalo;
	private VistaIntervalos vistaIntervalo;
	private javax.swing.JSpinner spinner;
	 
	 
	public  ControladorIntervalos(ModeloIntervalos modelo) {

		this.modeloIntervalo = modelo;
		//this.vistaIntervalo = vista;

	}

	private class EscuchaSpinnerXMin implements ChangeListener {

		public void stateChanged(ChangeEvent e) {
			spinner=(JSpinner)e.getSource();
			Number valor =(Number) spinner.getValue();
			modeloIntervalo.setXMin(valor.doubleValue());
		}
	}

	
	
	public ChangeListener getListenerSpinnerXMin() {
		return new EscuchaSpinnerXMin();
	}
	
	private class EscuchaSpinnerXMax implements ChangeListener {

		public void stateChanged(ChangeEvent e) {
			spinner=(JSpinner)e.getSource();
			Number valor =(Number) spinner.getValue();
			modeloIntervalo.setXMax(valor.doubleValue());
		}
	}

	public ChangeListener getListenerSpinnerXMax() {
		return new EscuchaSpinnerXMax();
	}
	
	private class EscuchaSpinnerYMin implements ChangeListener {

		public void stateChanged(ChangeEvent e) {
			spinner=(JSpinner)e.getSource();
			Number valor =(Number) spinner.getValue();
			modeloIntervalo.setYMin(valor.doubleValue());
		}
	}

	public ChangeListener getListenerSpinnerYMin() {
		return new EscuchaSpinnerXMin();
	}
	
	private class EscuchaSpinnerYMax implements ChangeListener {

		public void stateChanged(ChangeEvent e) {
			spinner=(JSpinner)e.getSource();
			Number valor =(Number) spinner.getValue();
			modeloIntervalo.setYMax(valor.doubleValue());
		}
	}

	public ChangeListener getListenerSpinnerYMax() {
		return new EscuchaSpinnerXMin();
	}

	public void setVistaIntervalo(VistaIntervalos vistaIntervalo) {
		this.vistaIntervalo = vistaIntervalo;
	}
	

	
	
}
